/**
  ******************************************************************************
  * @file    Project/STM32F10x_StdPeriph_Template/main.c 
  * @author  MCD Application Team
  * @version V3.5.0
  * @date    08-April-2011
  * @brief   Main program body
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */  

/* Includes ------------------------------------------------------------------*/

#include "board_hardware_config.h"
#include "function_config.h"
#include "user_data.h"
#include "app_procotol.h"
/** @addtogroup STM32F10x_StdPeriph_Template
  * @{
  */

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/

/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/

unsigned int apptestttl = 5000;
void app_test()
{
     if(apptestttl < 1)
     {
        #ifdef _DEBUG
         debug_timestringout("test\r\n");
         #else
            dev_uart1_send("res test\r\n",10);
         #endif
         apptestttl = 1000;
     }
}


/* Private functions ---------------------------------------------------------*/
void  app_showver(void);
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
   char tempbuf[100];
   unsigned int len = 0;

	 NVIC_Configuration();

   /* init board */
   board_init();
   
   app_showver(); 
  /*  Add your application code here */

   userconfig_parameter_read_set();
   
   #ifdef MCUWDT_ENB
       IWDG_Init();
    #endif 

    dev_uart1_send("hello app citou", 15);

  while (1)
  {

  //  app_test();
     dev_uart1_readrx(tempbuf,&len);
     if(len > 0)
        serialReceiveData(tempbuf,len);


     #ifdef MCUWDT_ENB
       IWDG_Process();
     #endif 
  }
}


#ifdef  USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)
{ 
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

/**
  * @}
  */


/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
